An Over The Air (OTA) upgrade is a way that facilitates an update of device firmware by a user so as to fix a system bug. In an OTA upgrade, a data flow is generally carried over a network, such as a Global System for Mobile Communications (GSM), a Code Division Multiple Access (CDMA), or a Wideband Code Division Multiple Access (WCDMA), to update a target device or for data transmission. An OTA upgrade does not require downloading of a complete data package and is an upgrade performed on the basis of existing system software, which greatly saves time of an upgrade for a user and is therefore used more widely.
An OTA upgrade method in the prior art generally includes: starting an upgrade thread, reading content of an upgrade script from an upgrade package, where the upgrade script indicates progress bar display, and a file to be deleted, or a file to be patched, or a file to be added; and running an upgrade program sentence by sentence according to the content in the script.
The prior art has at least the following disadvantage:
During an existing OTA upgrade process, once a user cancels an upgrade or an upgrade fails accidentally, it is possible that a system runs improperly and even cannot start, resulting in a serious accident.